package com.dxy.df.modules.service.impl;

import com.dxy.df.constants.ConstStrings;
import com.dxy.df.core.shiro.ShiroUtils;
import com.dxy.df.modules.bean.vo.UserAcceptRiceDetailVo;
import com.dxy.df.modules.service.UserAcceptRiceRecordService;
import com.dxy.df.utils.UcBeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalTime;
import java.util.List;

import com.dxy.df.modules.bean.entity.UserPublishAcceptRiceEntity;
import com.dxy.df.modules.bean.vo.UserPublishAcceptRiceVo;
import com.dxy.df.modules.bean.query.UserPublishAcceptRiceQuery;
import com.dxy.df.modules.bean.put.UserPublishAcceptRicePut;
import com.dxy.df.modules.dao.UserPublishAcceptRiceMapper;
import com.dxy.df.modules.service.UserPublishAcceptRiceService;


/**
 * @author biz@dxy.cn
 * @describe 用户收饭信息发布
 * @date 2019-10-25 15:36:06
 */
@Service
public class UserPublishAcceptRiceServiceImpl implements UserPublishAcceptRiceService {
	@Autowired
	private UserPublishAcceptRiceMapper userPublishAcceptRiceMapper;

	@Override
	public UserAcceptRiceDetailVo queryDetail(UserPublishAcceptRiceQuery query) {
		return userPublishAcceptRiceMapper.queryDetail(query.getUserId());
	}

	@Override
	public UserPublishAcceptRiceEntity queryObject(UserPublishAcceptRiceQuery query){
		return userPublishAcceptRiceMapper.queryObject(query);
	}
	
	@Override
	public List<UserPublishAcceptRiceVo> queryList(UserPublishAcceptRiceQuery query){
		return userPublishAcceptRiceMapper.queryList(query);
	}
	
	@Override
	public int queryTotal(UserPublishAcceptRiceQuery query){
		return userPublishAcceptRiceMapper.queryTotal(query);
	}
	
	@Override
	public UserPublishAcceptRiceEntity save(UserPublishAcceptRicePut put){
		UserPublishAcceptRiceEntity entity = UcBeanUtils.copyPropertiesForDDL(put,
				UserPublishAcceptRiceEntity.class, ConstStrings.ADD);
		entity.setUserId(ShiroUtils.getUserAccount());
		userPublishAcceptRiceMapper.save(entity);
		return entity;
	}
	
	@Override
	public void update(UserPublishAcceptRicePut put){
		UserPublishAcceptRiceEntity entity = UcBeanUtils.copyPropertiesForDDL(put, UserPublishAcceptRiceEntity.class, "");
		entity.setUserId(ShiroUtils.getUserAccount());
		userPublishAcceptRiceMapper.update(entity);
	}
	
	@Override
	public void delete(Integer id){
		userPublishAcceptRiceMapper.delete(id);
	}

	@Override
    public int deleteBatch(Integer[] ids){
		return userPublishAcceptRiceMapper.deleteBatch(ids);
	}

	@Override
	public UserPublishAcceptRiceVo querySuitInfo(String riceName) {
		return userPublishAcceptRiceMapper.querySuitInfo(riceName);
	}

}
